package com.hit.server.api.type;

import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * @author kehanjiang
 * @date 2023/09/15
 */
public enum TicketStatusEnums {
    STATUS_NONE("0", "未执行"),

    STATUS_EXECUTING("1", "执行中"),

    STATUS_PAUSED("2", "暂停中"),

    STATUS_STOP("3", "停止"),

    STATUS_FINISHED("4", "完成"),

    STATUS_FAIL("5", "执行失败"),
    ;
    private String code;

    private String desc;

    TicketStatusEnums(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    private static final Map<String, TicketStatusEnums> MAP = Stream.of(TicketStatusEnums.values()).collect(Collectors.toMap(TicketStatusEnums::getCode, v -> v));

    public static TicketStatusEnums getByCode(String code) {
        return MAP.get(code);
    }
}
